<?php if (!defined('THINK_PATH')) exit();?> <!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>提现审核</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <link rel="shortcut icon" href="favicon.ico"> <link href="/game/Public/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/game/Public/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/game/Public/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/game/Public/admin/css/animate.css" rel="stylesheet">
    <link href="/game/Public/admin/css/style.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>提现申请列表</h5>
                        <div class="ibox-tools">                           
                        </div>
                    </div>
                    <div class="ibox-content">
                        <div class="row ">
                        <form method="get" action="<?php echo U('Admin/System/withdrawReview');?>">
                            <div class="col-sm-3 m-b-xs">
                                <select class="input-sm form-control input-s-sm inline" name="keywords">
                                    <option value="">请选择搜索字段</option>
                                    <option value="admin_id" <?php if(($keywords) == "admin_id"): ?>selected='selected'<?php endif; ?>>代理ID</option>
                                    <option value="truename" <?php if(($keywords) == "truename"): ?>selected='selected'<?php endif; ?>>代理姓名</option>
                                    <option value="status" <?php if(($keywords) == "status"): ?>selected='selected'<?php endif; ?>>审核状态</option>
                                </select>
                            </div>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <input type="text" placeholder="查询审核状态时请输入0(待审核),1(已通过),2(已拒绝)" class="input-sm form-control" value="<?php echo ($keyvalue); ?>" name="keyvalue"> <span class="input-group-btn">
                                        <button type="submit" class="btn btn-sm btn-primary"> 搜索</button> </span>
                                </div>
                            </div>
                        </form>
                        </div>
                    </div>
                    <div class="ibox-content">

                        <table class="table table-bordered table-hover">
                            <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>姓名</th>
                                    <th>提现金额</th>
                                    <th>提现方式</th>
                                    <th>开户行</th>
                                    <th>收款账号</th>
                                    <th>提现时间</th>
                                    <th>审核时间</th>
                                    <th>被拒原因</th>
                                    <th>状态</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                            <?php if(empty($adminList)): ?><tr>
                                <td colspan="12">没有相关数据！</td>
                            </tr><?php endif; ?>
                            <?php if(is_array($adminList)): foreach($adminList as $key=>$v): ?><tr>
                                    <td><?php echo ($v["id"]); ?></td>
                                    <td>
                                    <?php if(empty($v["truename"])): echo ($v["phone"]); endif; ?>
                                    <?php echo ($v["truename"]); ?></td>
                                    <td><?php echo ($v["amount"]); ?></td>
                                    <td><?php switch($v["payment_type"]): case "1": ?><span >支付宝</span><?php break;?>
                                    <?php case "2": ?><span >微信</span><?php break;?>
                                    <?php case "3": ?><span >银行卡</span><?php break; endswitch;?></td>
                                    <td><?php echo ($v["bank"]); ?></td>
                                    <td><?php echo ($v["payment_no"]); ?></td>
                                    <td><?php echo ($v["addtime"]); ?></td>
                                    <td><?php echo ($v["modify_time"]); ?></td>
                                    <td><?php echo ($v["note"]); ?></td>
                                    <td><?php switch($v["status"]): case "0": ?><span class="corange">待审核</span><?php break;?>
                                    <?php case "1": ?><span class="cgreen">已转账</span><?php break;?>
                                    <?php case "2": ?><span class="cred">已拒绝</span><?php break; endswitch;?></td>
                                    <td>
                                    <?php if(($v["status"]) == "0"): ?><a href="#" onclick="review(<?php echo ($v["id"]); ?>,1,<?php echo ($v["amount"]); ?>,<?php echo ($v["admin_id"]); ?>)">转账</a>&nbsp;|&nbsp;<a href="#" onclick="review(<?php echo ($v["id"]); ?>,2,<?php echo ($v["amount"]); ?>)">拒绝</a>
                                    <?php else: ?>
                                    <a href="#" onclick="review(<?php echo ($v["id"]); ?>,3)">删除</a><?php endif; ?>
                                    </td>
                                </tr><?php endforeach; endif; ?> 
                            </tbody>
                                
                        </table>
                        <?php echo ($page); ?>
                    </div>
                </div>
            </div>

        </div>
    </div>

    <!-- 全局js -->
    <script src="/game/Public/admin/js/jquery.min.js?v=2.1.4"></script>
    <script src="/game/Public/admin/js/bootstrap.min.js?v=3.3.6"></script>



    <!-- Peity -->
    <script src="/game/Public/admin/js/plugins/peity/jquery.peity.min.js"></script>

    <!-- 自定义js -->
    <script src="/game/Public/admin/js/content.js?v=1.0.0"></script>


    <!-- iCheck -->
    <script src="/game/Public/admin/js/plugins/iCheck/icheck.min.js"></script>

    <!-- Peity -->
    <!-- <script src="/game/Public/admin/js/demo/peity-demo.js"></script> -->

    <script>
        $(document).ready(function () {
            $('.i-checks').iCheck({
                checkboxClass: 'icheckbox_square-green',
                radioClass: 'iradio_square-green',
            });
        });


function review(id,status,withdrawAmount=0,admin_id=0){
        if (status==1) {
            var act='已转账';
            
        }else if (status==2) {
            var act='拒绝';
            var str='请输入拒绝原因';
        }else{
            var act='删除';
        }
     if(confirm("确定"+act+"吗？")){
        if (status==1) {
            var url="<?php echo U('Admin/System/review');?>?id="+id+"&status="+status+'&action=Withdraw';
            
        }else if (status==2){
            var note = prompt(str, ""); 
            var url="<?php echo U('Admin/System/review');?>?id="+id+"&status="+status+'&action=Withdraw';
        }else{
            var url="<?php echo U('Admin/System/del');?>?id="+id+'&action=Withdraw';
        }
        $.ajax({
             type:'post',
             url:url,
             data:{withdrawAmount:withdrawAmount,note:note,admin_id:admin_id},
             dataType:'json',
             success:function(data){ 
                if (data=='success') {
                    alert('操作成功！');
                    window.location.href="<?php echo U('Admin/System/withdrawReview');?>";
                }else{
                    alert('操作失败！');                                          
                }                          
             }
         })
     }
    
}
    </script>

    
    

</body>

</html>